package com.yang.xiao.hui.product.controller;

import com.yang.xiao.hui.product.entity.Product;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ProductController {
    @Value("${eureka.instance.instance-id}")
    private String intanceId;
    @RequestMapping("/info/{id}")
    @ResponseBody
    public Product getProductInfo(@PathVariable("id") Integer id){
        Product product = new Product();
        product.setId(id);
        product.setName("苹果手机");
        product.setServerInstance(intanceId);
        return product;
    }
}
